
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="UTF-8">
	<title>添加商品</title>
	<script th:src="@{/layui/layui.js}" type="text/javascript"></script>
	<link th:href="@{/layui/css/layui.css}" rel="stylesheet" />
	<script th:src="@{/js/selectM.js}" type="text/javascript"></script>
	<script th:src="@{/js/selectN.js}" type="text/javascript"></script>
	<link rel="stylesheet" th:href="@{/upload/css/publish.css}" media="all">
	<script type="text/javascript" th:src="@{/upload/js/move.js}"></script>
	<script type="text/javascript" th:src="@{/upload/js/publishImg.js}"></script>
	<!---->
	<!--<script type="text/javascript" th:src="@{/js/inputTag.js}"></script>
	<link th:href="@{/css/inputTag.css}" rel="stylesheet" />-->
</head>
<body>

<div class="layui-container" style="margin: 10px 0px;">

	<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
		<legend>退款审核</legend>
	</fieldset>

	<form class="layui-form layui-form-pane">



		<!--订单模块-->
		<div class="layui-form-item">
			<label class="layui-form-label">订单编号</label>
			<div class="layui-input-block">
				<input readonly class="layui-input" th:value="${os.orderSn}" name="orderSn" autocomplete="off"/>
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">订单金额</label>
			<div class="layui-input-block">
				<input readonly class="layui-input" th:value="${os.orderPrice}" id="orderPrice" name="orderPrice" autocomplete="off"/>
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">优惠券金额</label>
			<div class="layui-input-block">
				<input readonly class="layui-input" th:value="${os.coupenPrice}" id="coupenPrice" name="coupenPrice" autocomplete="off"/>
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">团购优惠金额</label>
			<div class="layui-input-block">
				<input readonly class="layui-input" th:value="${os.grouponPrice}" id="grouponPrice" name="grouponPrice" autocomplete="off"/>
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">用户积分减免</label>
			<div class="layui-input-block">
				<input readonly class="layui-input" th:value="${os.integralPrice}" id="integralPrice" name="integralPrice" autocomplete="off"/>
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">配送费用</label>
			<div class="layui-input-block">
				<input readonly class="layui-input" th:value="${os.freightPrice}" id="freightPrice" name="freightPrice" autocomplete="off"/>
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">实付金额</label>
			<div class="layui-input-block">
				<input readonly class="layui-input" id="actualPrice"  name="actualPrice" autocomplete="off"/>
			</div>
		</div>
		<!--todo 时间问题-->

		<!--		<div class="layui-form-item">-->
		<!--			<label class="layui-form-label">下单时间</label>-->
		<!--			<div class="layui-input-block">-->
		<!--				<input  class="layui-input" th:value="${os.createTime}" name="createTime" autocomplete="off"/>-->
		<!--			</div>-->
		<!--		</div>-->

		<!--		<div class="layui-form-item">-->
		<!--			<label class="layui-form-label">付款时间</label>-->
		<!--			<div class="layui-input-block">-->
		<!--				<input  class="layui-input" th:value="${os.payTime}" name="payTime" autocomplete="off"/>-->
		<!--			</div>-->
		<!--		</div>-->

		<div class="layui-form-item">
			<label class="layui-form-label">订单状态</label>
			<div class="layui-input-block">
				<input disabled="disabled" type="radio" name="orderStatus" value="0" title="已完成订单"  th:checked="${os.orderStatus} eq '0' " />
				<input disabled="disabled" type="radio" name="orderStatus" value="1" title="待支付订单"  th:checked="${os.orderStatus} eq '1' " />
				<input disabled="disabled" type="radio" name="orderStatus" value="2" title="支付异常订单"  th:checked="${os.orderStatus} eq '2' " />
				<input disabled="disabled" type="radio" name="orderStatus" value="3" title="代发货订单"  th:checked="${os.orderStatus} eq '3' " />
				<input disabled="disabled" type="radio" name="orderStatus" value="4" title="待收货订单"  th:checked="${os.orderStatus} eq '4' " />
				<input disabled="disabled" type="radio" name="orderStatus" value="5" title="退换货订单"  th:checked="${os.orderStatus} eq '5' " />
				<input disabled="disabled" type="radio" name="orderStatus" value="6" title="退款订单"  th:checked="${os.orderStatus} eq '6' " />
			</div>
		</div>

		<div class="layui-form-item" style="display: none;">
			<div class="layui-input-block">
				<a class="layui-btn" id="submitBtn2" lay-submit="" lay-filter="submitBtn2">提交</a>
			</div>
		</div>

	</form>

</div>

<script>


	var $;
	layui.use(['layedit','laydate','table','form','jquery','layer','upload','element','selectN','selectM'],function(){
		$ = layui.jquery;
		var form = layui.form,
				layer = layui.layer,
				laydate = layui.laydate;

		//订单金额
		var num1 = $("#orderPrice").val();
		//配送费用
		var num2 = $("#freightPrice").val();
		//优惠券
		var num3 = $("#coupenPrice").val();
		//团购优惠金额
		var num4 = $("#grouponPrice").val();
		//用户积分减免
		var num5 = $("#integralPrice").val();

		if (num1 >= 0,num2 >= 0,num3 >= 0,num4 >= 0,num5 >= 0){
			//实付金额
			var num = num1 - num2 - num3 - num4 - num5;

			console.log(num);
		}else {
			alert("运算错误，请检查数值是否正确");
		}

		$("#actualPrice").val(num);

		laydate.render({
			elem: '#updateTime' //指定元素
		});

		form.on('submit(submitBtn2)',function (data) {
			var formData = data.field;
			console.log(formData);
			$.ajax({
				type:'post',
				url:'/order/oc/update',
				data:formData,
				dataType:'json',
				success:function (result) {
					layer.msg(result.msg);
					if (result.is){
						let index = parent.layer.getFrameIndex(window.name);
						parent.layer.close(index);  //编辑成功后关闭父页面窗口
						parent.layui.table.reload('orderTable');//根据表格id刷新父页面表格
					}
				}
			})
		})

	});

	function btnSubmit2(){
		$('#submitBtn2').click();
	}




</script>

</body>
</html>

